﻿using SmartSapce.ServiceLocation;
using SmartSpace.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SmartSpace.WebApp._console.core
{
    public partial class usergroup_add : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void _ctlBtnSave_Click(object sender, EventArgs e)
        {
            ICoreService service = ServiceLocator.Get<ICoreService>();

            UserGroup group = new UserGroup();
            group.Id = Guid.NewGuid();
            group.Code = _ctlEditName.Text;
            group.Caption = _ctlEditCaption.Text;
            group.SortIndex = Convert.ToInt32(_ctlEditSortIndex.Text);

            if (service.SaveUserGroup(group))
            {
                Response.Redirect(_ctlLinkBack.NavigateUrl);
            }
        }
    }
}